package com.ruoyi.web.controller.system;

import com.ruoyi.system.domain.CampusNavigation;
import com.ruoyi.system.domain.Result;
import com.ruoyi.system.service.CampusNavigationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/system/hospital/navigation")
public class CampusNavigationController {
    @Autowired
    private CampusNavigationService navigationService;

    @GetMapping("/list/{campusId}")
    public Result<List<CampusNavigation>> listByCampusId(@PathVariable Long campusId) {
        List<CampusNavigation> list = navigationService.listByCampusId(campusId);
        return Result.success(list);
    }

    @GetMapping("/{id}")
    public Result<CampusNavigation> getById(@PathVariable Long id) {
        CampusNavigation navigation = navigationService.getById(id);
        return Result.success(navigation);
    }

    @PostMapping("/save")
    public Result<Integer> save(@RequestBody CampusNavigation navigation) {
        int result = navigationService.save(navigation);
        return Result.success(result);
    }

    @PutMapping("/update")
    public Result<Integer> update(@RequestBody CampusNavigation navigation) {
        int result = navigationService.update(navigation);
        return Result.success(result);
    }

    @DeleteMapping("/delete/{id}")
    public Result<Integer> deleteByCampusId(@PathVariable Long id) {
        int result = navigationService.deleteByCampusId(id);
        return Result.success(result);
    }
}
